Time-alignment measurment for hybrid HD radio technology

ABSTRACT

A method for processing a digital audio broadcast signal in a radio receiver, includes: receiving a hybrid broadcast signal; demodulating the hybrid broadcast signal to produce an analog audio stream and a digital audio stream; and using a normalized cross-correlation of envelopes of the analog audio stream and the digital audio stream to measure a time offset between the analog audio stream and the digital audio stream. The time offset can be used to align the analog audio stream and the digital audio stream for subsequent blending of an output of the radio receiver from the analog audio stream to the digital audio stream or from the digital audio stream to the analog audio stream.

FIELD OF THE INVENTION

The described methods and apparatus relate to the time alignment ofanalog and digital pathways in hybrid digital radio systems.

BACKGROUND OF THE INVENTION

Digital radio broadcasting technology delivers digital audio and dataservices to mobile, portable, and fixed receivers. One type of digitalradio broadcasting, referred to as In-Band On-Channel (IBOC) digitalaudio broadcasting (DAB), uses terrestrial transmitters in the existingMedium Frequency (MF) and Very High Frequency (VHF) radio bands. HDRadio™ technology, developed by iBiquity Digital Corporation, is oneexample of an IBOC implementation for digital radio broadcasting andreception.

Both AM and FM In-Band On-Channel (IBOC) hybrid broadcasting systemsutilize a composite signal including an analog modulated carrier and aplurality of digitally modulated subcarriers. Program content (e.g.,audio) can be redundantly transmitted on the analog modulated carrierand the digitally modulated subcarriers. The analog audio is delayed atthe transmitter by a diversity delay. Using the hybrid mode,broadcasters may continue to transmit analog AM and FM simultaneouslywith higher-quality and more robust digital signals, allowing themselvesand their listeners to convert from analog-to-digital radio whilemaintaining their current frequency allocations.

The digital signal is delayed in the receiver with respect to its analogcounterpart such that time diversity can be used to mitigate the effectsof short signal outages and provide an instant analog audio signal forfast tuning. Hybrid-compatible digital radios incorporate a featurecalled “blend” which attempts to smoothly transition between outputtinganalog audio and digital audio after initial tuning, or whenever thedigital audio quality crosses appropriate thresholds.

In the absence of the digital audio signal (for example, when thechannel is initially tuned) the analog AM or FM backup audio signal isfed to the audio output. When the digital audio signal becomesavailable, the blend function smoothly attenuates and eventuallyreplaces the analog backup signal with the digital audio signal whileblending in the digital audio signal such that the transition preservessome continuity of the audio program. Similar blending occurs duringchannel outages which corrupt the digital signal. In this case theanalog signal is gradually blended into the output audio signal byattenuating the digital signal such that the audio is fully blended toanalog when the digital corruption appears at the audio output.

Blending will typically occur at the edge of digital coverage and atother locations within the coverage contour where the digital waveformhas been corrupted. When a short outage does occur, as when travelingunder a bridge in marginal signal conditions, the digital audio isreplaced by an analog signal.

When blending occurs, it is important that the content on the analogaudio and digital audio channels is time-aligned to ensure that thetransition is barely noticed by the listener. The listener should detectlittle other than possible inherent quality differences in analog anddigital audio at these blend points. If the broadcast station does nothave the analog and digital audio signals aligned, then the result couldbe a harsh-sounding transition between digital and analog audio. Thismisalignment or “offset” may occur because of audio processingdifferences between the analog audio and digital audio paths at thebroadcast facility.

The analog and digital signals are typically generated with two separatesignal-generation paths before combining for output. The use ofdifferent audio-processing techniques and different signal-generationmethods makes the alignment of these two signals nontrivial. Theblending should be smooth and continuous, which can happen only if theanalog and digital audio are properly aligned.

The effectiveness of any digital/analog audio alignment technique can bequantified using two key performance metrics: measurement time andoffset measurement error. Although measurement of the time required toestimate a valid offset can be straightforward, the actual misalignmentbetween analog and digital audio sources is often neither known norfixed. This is because audio processing typically causes different groupdelays within the constituent frequency bands of the source material.This group delay can change with time, as audio content variationaccentuates one band over another. When the audio processing applied atthe transmitter to the analog and digital sources is not the same—as isoften the case at actual radio stations—audio segments in correspondingfrequency bands have different group delays. As audio content changesover time, misalignment becomes dynamic. This makes it difficult toascertain whether a particular time-alignment algorithm provides anaccurate result.

Existing time alignment algorithms rely on locating a normalizedcross-correlation peak generated from the analog and digital audiosample vectors. When the analog and digital audio processing is thesame, a clearly visible correlation peak usually results.

However, techniques that rely solely on normalized cross-correlation ofdigital and analog audio vectors often produce erroneous results due tothe group-delay difference described above. When the analog and digitalaudio processing is different, the normalized cross correlation is oftenrelatively low and lacks a definitive peak.

Although multiple measurements averaged over time can reduce the dynamicoffset measurement error, this leads to excessive measurement times andpotential residual offset error due to persistent group-delaydifferences. Since an HD Radio receiver may use this measurement toimprove real-time hybrid audio blending, excessive measurement time andoffset error make this a less attractive solution. Therefore, improvedtechniques for measuring time offsets are desired.

SUMMARY

In a first aspect, a method for processing a digital audio broadcastsignal in a radio receiver, includes: receiving a hybrid broadcastsignal; demodulating the hybrid broadcast signal to produce an analogaudio stream and a digital audio stream; and using a normalizedcross-correlation of envelopes of the analog audio stream and thedigital audio stream to measure a time offset between the analog audiostream and the digital audio stream.

In another aspect, a radio receiver includes processing circuitryconfigured to receive a hybrid broadcast signal; to demodulate thehybrid broadcast signal to produce an analog audio stream and a digitalaudio stream; and to use a normalized cross-correlation of envelopes ofthe analog audio stream and the digital audio stream to measure a timeoffset between the analog audio stream and the digital audio stream.

In another aspect, a method for aligning analog and digital signalsincludes: receiving or generating an analog audio stream and a digitalaudio stream; using a normalized cross-correlation of envelopes of theanalog audio stream and the digital audio stream to measure a timeoffset between the analog audio stream and the digital audio stream; andusing the time offset to align the analog audio stream and the digitalaudio stream.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a graph of a typical normalized cross-correlation peak withidentical analog/digital audio processing.

FIG. 2 is a graph of a typical normalized cross-correlation withdifferent analog/digital audio processing.

FIG. 3 is a graph of a typical normalized cross-correlation of audioenvelopes with different analog/digital audio processing.

FIG. 4 is a high-level functional block diagram of an HD Radio receiverhighlighting the time-alignment algorithm.

FIG. 5 is a signal flow diagram of an exemplary filtering and decimationfunction.

FIG. 6 is a graph of a filter impulse response.

FIGS. 7 through 11 are graphs that illustrate filter passbands.

FIG. 12 is a functional block diagram of an exemplary time-alignmentalgorithm.

FIG. 13 is a graph of various cross-correlation coefficients.

FIG. 14 is a signal-flow diagram of an audio blending algorithm withdynamic threshold control.

DETAILED DESCRIPTION

Embodiments described herein relate to the processing of the digital andanalog portions of a digital radio broadcast signal. This descriptionincludes an algorithm for time alignment of analog and digital audiostreams for an HD Radio receiver or transmitter. While aspects of thedisclosure are presented in the context of an exemplary HD Radio system,it should be understood that the described methods and apparatus are notlimited to HD Radio systems and that the teachings herein are applicableto methods and apparatus that include the measurement of time offsetbetween two signals.

Previously known algorithms for time alignment of analog and digitalaudio streams rely on locating a normalized cross-correlation peakgenerated from the analog and digital audio sample vectors. When theanalog and digital audio processing is the same, a clearly visiblecorrelation peak usually results. For example, FIG. 1 is a graph of atypical normalized cross-correlation peak with identical analog/digitalaudio processing.

However, audio processing typically causes different group delays withinthe constituent frequency bands of the source material. This group delaycan change with time, as audio content variation accentuates onefrequency band over another. When the audio processing applied at thetransmitter to the analog and digital sources is not the same—as isoften the case at actual radio stations—audio segments in correspondingfrequency bands have different group delays. As audio content changesover time, misalignment becomes dynamic. This makes it difficult toascertain whether a particular time-alignment algorithm provides anaccurate result.

As a result of this group delay, when the analog and digital audioprocessing is different, the normalized cross correlation is oftenrelatively low and lacks a definitive peak. FIG. 2 is a graph of atypical normalized cross-correlation with different analog/digital audioprocessing. Therefore, techniques that rely solely on normalizedcross-correlation of digital and analog audio vectors often produceerroneous results.

Correlation of audio envelopes (with phase differences removed) can beused to reduce or eliminate the problems due to group delay differences.The techniques described herein utilize the correlation of audioenvelopes to solve the problem of offset measurement error caused bygroup-delay variations between the digital and analog audio streams.FIG. 3 is a graph of a typical normalized cross-correlation of audioenvelopes with different analog/digital audio processing.

The techniques described herein are efficient and require significantlyless measurement time than previously known techniques because the needfor consistency checks is reduced. Additionally, a technique forcorrecting group-delay differences during the blend ramp is described.

Time alignment between the analog audio and digital audio of a hybrid HDRadio waveform is needed to assure a smooth blend from digital to analogin the HD Radio receivers. Time misalignment sometimes occurs at thetransmitter, although alignment should be maintained. Misalignment canalso occur at the receiver due to implementation choices when creatingthe analog and digital audio streams. A time-offset measurement can beused to correct the misalignment when it is detected. It can also beused to adjust blending thresholds to inhibit blending when misalignmentis detected and to improve sound quality during audio blends.

The described technique is validated by measuring the normalized crosscorrelation of the analog and digital audio vectors after correcting anygroup delay differences between them. This results in a more accurate,efficient, and rapid time offset measurement than previous techniques.

In the described embodiment, multistage filtering and decimation areapplied to isolate critical frequency bands and improve processingefficiencies. Normalized cross-correlation of both the coarse and fineenvelopes of the analog and digital audio streams is used to measure thetime offset. As used in this description, a coarse envelope representsthe absolute value of an input audio signal after filtering anddecimation by a factor of 128, and a fine envelope represents theabsolute value of an input audio signal after filtering and decimationby a factor of 4. Correlation is performed in two steps—coarse andfine—to improve processing efficiency.

A high-level functional block diagram of an HD Radio receiver 10highlighting the time-alignment algorithm is shown in FIG. 4. An antenna12 receives a hybrid HD Radio signal that is input to an HD Radio tuner14. The tuner output includes an analog modulated signal on line 16 anda digitally modulated signal on line 18. Depending upon the inputsignal, the analog modulated signal could be amplitude modulated (AM) orfrequency modulated (FM) The AM or FM analog demodulator 20 produces astream of audio samples, referred to as the analog audio stream on line22. The HD Radio digital demodulator 24 produces a stream of digitalsymbols on line 26. The digital symbols on line 26 are deinterleaved anddecoded in a deinterleaver/FEC decoder 28 and deformatted in an audioframe deformatter 30 to produce digital audio frames on line 32. Thedigital audio frames are decoded in an HD Radio audio decoder 34 toproduce a digital audio signal on line 36. A time offset measurementfunction 38 receives the digital audio signal on line 40 and the analogaudio signal on line 42 and produces three outputs: a cross-correlationcoefficient on line 44; a time offset signal on line 46, and a phaseadjusted digital audio signal on line 48. The time offset signalcontrols the sample delay of the digital audio signal as shown in block50.

Cyclic redundancy check (CRC) bits of the digital audio frames arechecked to determine a CRC state. CRC state is determined for each audioframe (AF). For example, the CRC state value could be set to 1 if theCRC checks, and set to 0 otherwise. A blend control function 52 receivesa CRC state signal on line 54 and the cross-correlation coefficient online 44, and produces a blend control signal on line 56.

An audio analog-to-digital (A/D) blend function 58 receives the digitalaudio on line 60, the analog audio on line 22, the phase-adjusteddigital audio on line 48, and the blend control signal on line 56, andproduces a blended audio output on line 62. The analog audio signal online 42 and the digital audio signal on line 40 constitute a pair ofaudio signal vectors.

In the receiver depicted in FIG. 4, a pair of audio-signal vectors iscaptured for time alignment. One vector is for the analog audio signal(derived from the analog AM or FM demodulator) while the other vector isfor the digital signal (digitally decoded audio). Since the analog audiosignal is generally not delayed more than necessary for demodulation andfiltering processes, it will be used as the reference time signal. Thedigital audio stream should be time-aligned to the analog audio streamfor blending purposes. An intentional diversity delay between the twoaudio streams allows for time adjustment of the digital audio streamrelative to the analog audio stream.

The time offset measurement block 38 in FIG. 4 provides three algorithmoutputs, which correspond to three possible embodiments, wherein:

(1) A cross-correlation coefficient may be passed to the blend algorithmto adjust blend thresholds and inhibit blending when misalignment isdetected;

(2) The delay of the digital audio signal may be adjusted in real timeusing the measured time offset, thereby automatically aligning theanalog and digital audio; or

(3) Phase-adjusted digital audio may temporarily replace the inputdigital audio to improve sound quality during blends.

In another embodiment, a filtered time-offset measurement could also beused for automatic time alignment of the analog and digital audiosignals in HD Radio hybrid transmitters.

Details of the time-offset measurement technique are described next.

In this embodiment, monophonic versions of the analog and digital audiostreams are used to measure time offset. This measurement is performedin multiple steps to enhance efficiency. It is assumed here that theanalog and digital audio streams are sampled simultaneously and inputinto the measurement device. The appropriate metric for estimating timeoffset for the analog and digital audio signals is the correlationcoefficient function implemented as a normalized cross-correlationfunction. The correlation coefficient function has the property that itapproaches unity when the two signals are time-aligned and identical,except for possibly an arbitrary scale-factor difference. Thecoefficient generally becomes statistically smaller as the time offsetincreases. The correlation coefficient is also computed for the envelopeof the time-domain signals due to its tolerance to group-delaydifferences between the analog and digital signals.

Exemplary pseudocode for the executive function that controls thetime-offset measurements, MEAS_TIME_ALIGNMENT, is shown below.

MEAS_TIME_ALIGNMENT M = 2^(∧)13; “length of analog audio vector at 44.1ksps” N = 2^(∧)17; “length of digital audio vector (implementationdependent)” results = 0; resultsprev = 0; resultsprev2 = 0; “Clearoutput vectors” for k = 0 . . . K − 1; “K is the number of measurementvectors”  get vector x; “vector of M analog audio samples”  get vectory; “vector of N digital audio samples”  [xenv, yenv, xabsf, yabsf,xbass, ybass] = filter_vectors(x, y)  lagmin = 0  lagmax = length(yenv)− length(xenv); “Set coarse lag range”  [peakabs, offset, corr_coef,corr_phadj, ynormadj, peakbass] =   meas_offset(x, y, xenv, yenv, xabsf,yabsf, xbass, ybass, lagmin, lagmax)  “output arguments are set to zeroif not measured due to RETURN or invalid”  resultsprev2 = resultsprev;“save results from two iterations ago”  resultsprev = results; “saveresults from previous iteration”  results = [peakabs, offset, corr_coef,corr_phadj, ynormadj, peakbass]  “Analyze results to determine if timeoffset measurement is successful”  if (corr_phadj > 0.8) ^(∧)   $\quad\begin{Bmatrix}{( {{peakabs} > 0.8} )\bigvee} \\{\lbrack {( | {{offset} - {offset\_ prev}} \middle| {\leq 2}  )\bigwedge( {{{peakabs} + {peakabs\_ prev}} > 1} )} \rbrack\bigvee} \\\lbrack {( | {{offset} - {offset\_ prev2}} \middle| {\leq 2}  )\bigwedge( {{{peakabs} + {peakabs\_ prev2}} > 1} )} \rbrack\end{Bmatrix}$    break; “Pass:return results”  end if  “Continue withnext measurement vector if results are not validated” end for

A vector y of N digital audio samples is first formed for themeasurement. Another smaller M-sample vector x of analog audio samplesis used as a reference analog audio vector.

The goal is to find a vector subset of y that is time-aligned with x.Ideally, the signals are nominally time-aligned with the center of theyvector. This allows the time-offset measurement to be computed over arange of ±(N−M)/2 samples relative to the midpoint of they vector. Arecommended value of N is 2¹⁷=131072 audio samples spanning nearly threeseconds at a sample rate of 44.1 ksps. The search range is about ±1.4seconds for M=2¹³=8192 (approximately 186 msec).

The analog and digital audio input vectors are then passed through afilter_vectors function to isolate the desired audio frequency bands andlimit processor throughput requirements. The audio spectrum is separatedinto several distinct passbands for subsequent processing. These bandsinclude the full audio passband, bass frequencies, and bandpassfrequencies. The bandpass frequencies are used create the audioenvelopes that are required for accurate cross-correlation with phasedifferences removed. Bass frequencies are removed from the bandpasssignals since they may introduce large group-delay errors whenanalog/digital audio processing is different; however, the isolated bassfrequencies may be useful to validate the polarity of the audio signals.Furthermore, high frequencies are removed from the bandpass signalbecause time-alignment information is concentrated in lower non-bassfrequencies. The entire audio passband is used to predict potentialblend sound quality and validate envelope correlations.

After filtering, the range of coarse lag values is set and functionmeas_offset is called to perform the time-offset measurement. The coarselag values define the range of sample offsets over which the smalleranalog audio envelope is correlated against the larger digital audioenvelope. This range is set to the difference in length between theanalog and digital audio envelopes. After the coarse envelopecorrelation is complete, a fine envelope correlation is performed at ahigher sample rate over a narrower range of lag values.

The results are then analyzed to determine whether the correlation peaksand offset values are valid. Validity is determined by ensuring that keycorrelation peaks exceed a threshold, and that these peak correlationvalues and their corresponding offset values are temporally consistent.

If not, the process repeats using new input measurement vectors until avalid time offset is declared. Once a valid time offset has beencomputed, the algorithm can be run periodically to ensure that propertime-alignment is being maintained.

The executive pseudocode MEAS_TIME_ALIGNMENT calls subsequent functions.

The time-offset measurements as a hierarchical series of functions aredescribed below. These functions are described either as signal-flowdiagrams or pseudocode, whichever is more appropriate for the functionFIGS. 5 and 12 are annotated with step numbers for cross-referencingwith step-by-step implementation details provided below.

FIG. 5 is a signal flow diagram of the first function filter_vectorscalled by MEAS_TIME_ALIGNMENT.

The input audio vectors x and y on lines 70 and 72 are initiallyprocessed in multiple stages of filtering and decimation, as shown inFIG. 5. The x and y sample streams are available for further processingon lines 74 and 76. Multistage processing is efficient and facilitatesseveral types of measurements. The x and y vectors are first lowpassfiltered by filters 78 and 80 to prevent subsequent cross-correlation ofhigher frequencies that could be affected by slight time offsets, and toimprove computational efficiency. This produces xlpf and ylpf signals onlines 82 and 84, respectively. Even lower bass frequencies are removedfrom the xlpf and ylpf signals using filters 86 and 88 and combiners 90and 92 to create bandpass signals xbpf and ybpf on line 94 and 96. Thiseliminates large group-delay variations caused by different bassprocessing on the analog and digital versions of the audio, which couldalso affect the envelope in subsequent processing. The xbass and ybasssignals are available for further processing on lines 98 and 100.

The bandpass filter stages are followed by an absolute-value function102 and 104 to allow envelope correlation. The resulting xabs and yabssignals on lines 106 and 108 are then filtered by filters 110 and 112 toproduce xabsf and yabsf on lines 114 and 116, which are used todetermine the fine cross-correlation peak. These signals are furtherfiltered and decimated in filters 118 and 120 to yield the coarseenvelope signals xenv and yenv on lines 122 and 124. The coarse envelopecross-correlation is used to locate the vicinity of the correlation timeoffset, allowing subsequent fine correlation of xabsf and yabsf to beefficiently computed over a narrower range of lag values.

FIG. 6 is a graph of a LPF FIR filter impulse response. Each of thelowpass filters (LPFs) in FIG. 5 has a similar impulse response based ona cosine-squared windowed sinc function, as illustrated in FIG. 6. Allfilters have the same shape spread over the number of selectedcoefficients, K, where K=45 in this example.

The signals are scaled in time by the number of filter coefficients K,which inversely scales frequency span. The filter coefficients for eachpredetermined length K can be pre-computed for efficiency using functioncompute_LPF_coefs, defined below.

Exemplary pseudocode for the function compute_LPF_coefs for generatingfilter coefficients follows.

Function[h] = compute_LPF_coefs(K) “Compute K LPF FIR filtercoefficients, K is odd, k = 0 to K − 1”$h_{\frac{K - 1}{2}} = {\frac{4 \cdot \pi}{K + 1}\text{;}\mspace{11mu}{``{{center}\mspace{14mu}{coefficient}\mspace{14mu}{to}\mspace{14mu}{avoid}\mspace{14mu}{divide}\text{-}{by}\text{-}{zero}}"}}$${{for}\mspace{14mu} k} = {1\mspace{14mu}\ldots\mspace{14mu}\frac{K - 1}{2}}$ $h_{k + \frac{K - 1}{2}} = {\frac{{\cos( \frac{\pi \cdot k}{K + 1} )}^{2} \cdot {\sin( \frac{8 \cdot \pi \cdot k}{K + 1} )}}{2 \cdot k}\text{;}\mspace{11mu}{``{{upper}\mspace{14mu}{half}\mspace{14mu}{coefficients}}"}}$ $h_{\frac{K - 1}{2} - k} = {h_{k + \frac{K - 1}{2}}\text{;}\mspace{11mu}{``{{copy}\mspace{14mu}{to}\mspace{14mu}{lower}\mspace{14mu}{half}\mspace{14mu}{coefficients}}"}}$end for$h = {\frac{h}{\sum\limits_{k = 0}^{K - 1}h_{i}}\text{;}\mspace{11mu}{``{{normalize}\mspace{14mu}{filter}\mspace{14mu}{coefficient}\mspace{14mu}{vector}\mspace{14mu}{for}\mspace{14mu}{unity}\mspace{14mu}{dc}\mspace{14mu}{gain}}"}}$

The filter inputs include the input vector u, filter coefficients h, andthe output decimation rate R.

Exemplary pseudocode for the LPF function is.

Function[v] = LPF(u, h, R) “u is the input signal vector, h is thefilter coefficient vector, R is decimation rate” K = length(h); “Numberof filter coefficients”$N = {{{ceil}( \frac{{{length}(u)} - K + 1}{R} )}\text{;}\mspace{11mu}{``{N\mspace{14mu}{is}\mspace{14mu}{the}\mspace{14mu}{length}\mspace{14mu}{of}\mspace{14mu}{the}\mspace{14mu}{filter}\mspace{14mu}{output}\mspace{14mu}{vector}\mspace{14mu} v}"}}$$v_{n} = {{\sum\limits_{k = 0}^{K - 1}{{h_{k} \cdot u_{{n \cdot R} + k}}\text{;}\mspace{11mu}{for}\mspace{14mu} n}} = {{0\mspace{14mu}\ldots\mspace{14mu} N} - 1}}$

Filter passbands for the various signals of FIG. 5 in an exemplaryembodiment are shown in FIGS. 7-11.

FIG. 7 shows the passband of xlpf from LPF(x, hlpf, 4). FIG. 8 shows thepassband of xbass from LPF(xlpf, hbass, 1). FIG. 9 shows the passband ofxbpf from appropriately delayed LPF(x, hlpf, 4)—LPF(xlpf hbass, 1). FIG.10 shows the passband of xabsf from LPF(xabs, habs, 1). FIG. 11 showsthe passband of xenv from LPF(xabsf, henv, 32).

After filtering, the executive MEAS_TIME_ALIGNMENT estimates the timeoffset between input analog and digital audio signals by invokingfunction meas_offset. An embodiment of a signal-flow diagram of thesecond function meas_offset called by executive MEAS_TIME_ALIGNMENT isshown in FIG. 12.

As alluded to above, normalized cross-correlation should be performed onthe envelopes of the audio signals to prevent group-delay differencescaused by different analog/digital audio processing. For efficiency,this correlation is performed in two steps—coarse and fine—by thefunction CROSS_CORRELATE.

Referring to FIG. 12, the meas_offset function first calls aCROSS_CORRELATE function 130 to compute a coarse cross-correlationcoefficient using the input audio envelopes xenv on line 122 and yenv online 124 (which are decimated by a factor of 128 from the input audiosignals). The range of lag values on line 132 used for this correlationis computed by the executive, and allows sliding of the smaller xenvvector through the entire length of yenv. The coarse correlation inblock 130 is performed at a modest sample rate. The resulting coarsecorrelation peak index lagpqenv on line 126 effectively narrows therange of lag values (from lagabsmin to lagabsmax in block 132) forsubsequent fine correlation in block 134 of xabsf on line 114 and yabsfon line 116. This fine correlation is also performed by functionCROSS_CORRELATE at a sample rate that is 32 times higher. The index ofthe fine correlation peak, following conversion to an integer number of44.1-ksps audio samples in block 136, is output as offset on line 138(the desired time-offset measurement). The peak correlation valuepeakabs is determined in block 134 and returned on line 142. If theresult of either the coarse or fine correlation is invalid, control ispassed back to the executive and processing continues with the nextmeasurement vector, as shown in blocks 144 and 146.

Exemplary pseudocode for the CROSS_CORRELATE function is provided below.

Function[peak,lagpq] = CROSS_CORRELATE(u, v,lagmin,lagmax) “Compute thecross - correlation of the input vectors, and their componentsa & b”[coefa,coefb,coef] = corr_coef_vectors(u, v, lagmin,lagmax) “Find thepeak of the vectors” [peaka,lagpqa] = peak_lag(coefa) [peakb,lagpqb] =peak_lag(coefb) [peak,lagpq] = peak_lag(coef ) “Check if the measurementpeak is valid” RETURN FAIL if (peak < 0.7)∨(|lagpq − lagpqa| >0.5)∨(|lagpq − lagpqb| > 0.5)

The CROSS_CORRELATE function first calls function corr_coef_vectors tosplit in half each input vector and compute cross-correlationcoefficients not only for the composite input vectors (coef), but alsofor their bifurcated components (coefa and coefb). The peak indexcorresponding to each of the three correlation coefficients (lagpq,lagpqa, and lagpqb) is also determined by function peak_lag. Thispermits correlation validation via temporal consistency. If the lags atthe peaks of the bifurcated components both fall within half a sample ofthe composite lag (at the native sample rate), and if the composite peakvalue exceeds a modest threshold, the correlation is deemed valid.Otherwise, control is passed back to meas_offset andMEAS_TIME_ALIGNMENT, and processing will continue with the nextmeasurement vector.

After the inputs to function corr_coef_vectors have been bifurcated, themean is removed from each half to eliminate the bias introduced by theabsolute value (envelope) operation in function filter_vectors. Thecross-correlation coefficient also requires normalization by the signalenergy (computed via auto-correlation of each input) to ensure theoutput value does not exceed unity. All of this processing need only beperformed once for the shorter analog input vector u. However, thedigital input vector v must be truncated to the length of the analogvector, and its normalization factors (SMra and Svvb) and the resultingcross-correlation coefficients are calculated for each lag value betweenlagmin and lagmax. To reduce processing requirements, the correlationoperations are performed only for the bifurcated vectors. The compositecorrelation coefficient coef is obtained through appropriate combinationof the bifurcated components.

Exemplary pseudocode of the first function corr_coef_vectors called byCROSS_CORRELATE is as follows. Note that all correlation operations areconcisely expressed as vector dot products.

Function[coefa, coefb, coef] = corr_coef_vectors(u, v, lagmin, lagmax)“cross-correlate smaller vector u over longer vector v over lag range”“bifurcate vector u into 2 parts ua and ub each of length Ka”${Ka} = {{floor}\{ \frac{{length}(u)}{2} \}}$ uam =subvector(u, 0 . . . Ka − 1); “extract first half of vector u” ua = uam− mean(uam) ubm = subvector (u, Ka . . . 2 · Ka − 1); “extract secondhalf of vector u” ub = ubm − mean(ubm) Suua = ua • ua; “vector dotproduct, scalar result” Suub = ub • ub; “vector dot product, scalarresult” for lag = lagmin . . . lagmax; “correlation coefficients eachlag”  vam = subvector(v, lag . . . lag + Ka − 1)  va = vam − mean(vam) vbm = subvector (v, lag + Ka . . . lag + 2 · Ka − 1)  vb = vbm − mean(vbm)  Svva = va • va  Svvb = vb • vb  Suva = ua • va  Suvb = ub • vb  ${coefa}_{lag} = \frac{Suva}{\sqrt{{Suua} \cdot {Svva}}}$  ${coefb}_{lag} = \frac{Suvb}{\sqrt{{Suub} \cdot {Svvb}}}$  ${coef}_{lag} = \frac{{Suva} + {Suvb}}{\sqrt{( {{Suua} + {Suub}} ) \cdot ( {{Svva} + {Svvb}} )}}$end for

Exemplary pseudocode of the second function peak_lag called byCROSS_CORRELATE is as follows.

Function[peak, lagpq] = peak_lag(coef) “Find vector peak and lag indexlagpq” L = length(coef) peak = 0 lagp = 0 for lag = 0 . . . L − 1  ifcoef_(lag) > peak   peak = coef_(lag)   lagp = lag end for if (lagp = 0)∨ (lagp = L − 1)  peak = 0  lagpq = 0 otherwise  “quadratic fit peak”  ${lagpq} = {{lagp} + \frac{{coef}_{{lagp} - 1} - {coef}_{{lagp} + 1}}{{2 \cdot ( {{coef}_{{lagp} - 1} + {coef}_{{lagp} + 1}} )} - {4 \cdot {coef}_{lagp}}}}$

Function peak_lag is called by CROSS_CORRELATE to find the peak valueand index of the input cross-correlation coefficient. Note that if thepeak lies on either end of the input vector, both the outputs (peak andlagpq) will be cleared, effectively failing the cross-correlationoperation. This is because it is not possible to determine whether amaximum at either end of the vector is truly a peak. Also, since thisfunction is run at a relatively coarse sample rate (either 44100/4=11025Hz or 44100/128=344.53125 Hz), the resolution of the peak lag value isfairly granular. This resolution is improved via quadratic interpolationof the peak index. The resulting output lagpq typically represents afractional number of samples; it is subsequently rounded to an integernumber of samples in the meas_offset function.

Function CORRELATION_METRICS in block 148 of FIG. 12 is called bymeas_offset to validate the fine time-offset measurement and generatephase-adjusted digital audio for improved blend quality. In thedescribed embodiment, all correlations are performed at the single lagoffset (as opposed to a range of lag values). As in other functions,correlations are normalized and compactly expressed as dot products.

Exemplary pseudocode of the function CORRELATION_METRICS called bymeas_offset is as follows.

Function[corr_coef, corr_phadj, ynormadj] = CORRELATION_METRICS(x, y,offset) Kt = 2^(floor{log2[length(x)]}); “truncate vector size tolargest power of 2” xpart = subvector(x, 0, Kt − 1) ypart = subvector(y,offset, offset + Kt − 1)${xnorm} = {\frac{xpart}{\sqrt{{xpart}\mspace{11mu}\bullet\mspace{11mu}{xpart}}};\mspace{11mu}{``{\bullet\mspace{11mu}{dot}\mspace{14mu}{product}\mspace{14mu}{scalar}\mspace{14mu}{result}}"}}$${ynorm} = {\frac{ypart}{\sqrt{{ypart}\mspace{11mu}\bullet\mspace{11mu}{ypart}}};\mspace{11mu}{``{\bullet\mspace{11mu}{dot}\mspace{14mu}{product}\mspace{14mu}{scalar}\mspace{14mu}{result}}"}}$corr_coef = xnorm • ynorm; “• dot product scalar result” XNORM =FFT(xnorm) YNORM = FFT(ynorm) XMAG = |XNORM|; “compute magnitude of eachelement of XNORM” YMAG = |YNORM|; “compute magnitude of each element ofYNORM” corr_phadj = Kt · XMAG • YMAG: “phase-adjusted correlationcoefficient”${YNORMADJ} = {\frac{{YMAG} \cdot {XNORM}}{XMAG}\text{;}\mspace{11mu}{``{{impose}\mspace{14mu}{XNORM}\mspace{14mu}{phase}\mspace{14mu}{onto}\mspace{14mu}{YNORM}\mspace{14mu}{elements}}"}}$ynormadj = IFFT(YNORMADJ); “phase-adjusted ynorm, ready for blending”

Although it is important to avoid the effects of group-delay differencesby correlating the envelopes of the analog and digital audio signals, itis also important to recognize that these envelopes contain no frequencyinformation. Function CORRELATION_METRICS in block 148 of FIG. 12cross-correlates the magnitudes of the input 44.1-ksps analog anddigital audio signals (x on line 74 and y on line 76) in the frequencydomain at the computed offset. If these frequency components are wellcorrelated (i.e., the output correlation coefficient corr phadj issufficiently high), there can be a high degree of confidence that thetime-offset measurement is correct. Note that input vector lengths aretruncated to the largest power of two to ensure more efficient operationof the FFTs, and constant Kt is an FFT-dependent scale factor.

Standard time-domain normalized cross-correlation of the input audiosignals x and y is also performed at lag value offset by functionCORRELATION_METRICS, yielding the output corr_coef. The value ofcorr_coef can be used to predict the sound quality of the blend. Aspreviously noted, however, corr_coef will likely yield ambiguous resultsif analog/digital audio processing differs. This would not be the case,however, if the phase of the digital audio input were somehow reconciledwith the analog phase prior to correlation. This is achieved inCORRELATION_METRICS by impressing the phase of the analog audio signalonto the magnitude of the digital signal. The resulting phase-adjusteddigital audio signal ynormadj could then be temporarily substituted forthe input digital audio y during blend ramps to improve sound quality.

Finally, cross-correlation of xbass on line 98 and ybass on line 100 isperformed by function CORRELATE_BASS in block 140 of FIG. 12 at the peakoffset value to form output variable peakbass. This measure indicateshow well the phase of the bass audio frequencies is aligned with thehigher frequencies. If the peakbass value is negative, then the analogor digital audio signal may be inverted. Output peakbass could be usedto detect potential phase inversion, to validate the time-offsetmeasurement, or to improve blend quality.

Exemplary pseudocode of the function CORRELATE_BASS called bymeas_offset is as follows.

Function[peakbass] = CORRELATE_BASS(xbass, ybass, lagpqabs)“cross-correlate shorter vector xbass over longer vector ybass at singlelag value lagpqabs” lag = round(lagpqabs) Kb = length(xbass) Sxx = xbass• xbass; “vector dot product, scalar result for normalization of xbass”y = subvector(ybass, lag . . . lag + Kb − 1); “select xbass-sizedsegment of ybass starting at lag” Syy = y • y; “normalization of y” Sxy= xbass • y${peakbass} = {\frac{Sxy}{\sqrt{{Sxx} \cdot {Syy}}}\text{;}\mspace{11mu}{``{{Cross}\text{-}{correlation}\mspace{14mu}{coefficient}\mspace{14mu}{at}\mspace{14mu}{peak}\mspace{14mu}{lag}\mspace{14mu}{value}}"}}$

Return values peakabs, offset, and corr_phadj of function meas_offsetare all used by the executive MEAS_TIME_ALIGNMENT for validating thetime-offset measurement.

The steps used to implement the time-offset measurement algorithm aredelineated in the executive pseudocode of MEAS_TIME_ALIGNMENT. The timeoffset is computed in several stages from coarse (envelope) to finecorrelation, with interpolation used between stages. This yields anefficient algorithm with sufficiently high accuracy. Steps 1 through 8describe the filtering operations defined in the signal-flow diagram ofFIG. 5.[xenv,yenv,xabsf,yabsf,xbass,ybass]=filter_vectors(x,y)

Steps 10 through 15 describe the correlation operations defined in thesignal-flow diagram of FIG. 12.[peakabs,offset,corr_coefcorr_phadj,ynormadj,peakbass]=meas_offset(x,y,xenv,yenv,xabsf,yabsfxbass,ybass,lagmin,lagmax)

Step 1—Pre-compute the filter coefficients for each of the fourconstituent filters in the filter_vectors function defined in thesignal-flow diagram of FIG. 5. The xbass and ybass signals are availablefor further processing on lines 98 and 100.

The number of coefficients for each filter (Klpf, Kbass, Kabs, and Kenv)is defined in FIG. 5. The filter coefficients are computed by thefunction compute_LPF_coefs defined above.hlpf=compute_LPF_coefs(Klpf)hbass=compute_LPF_coefs(Kbass)habs=compute_LPF_coefs(Kabs)henv=compute_LPF_coefs(Kenv)

Step 2—Prepare monophonic versions of the digital and analog audiostreams sampled at 44.1 ksps. It is recommended that the audio bechecked for possible missing digital audio frames or corrupted analogaudio. Capture another audio segment if corruption is detected on thepresent segment. Form x and y input vectors. The y vector consists of Ndigital audio samples. The x vector consists of M<N analog audio sampleswhich are nominally expected to align near the center of the y vector.

Step 3—Filter and decimate by rate R=4 (11,025-Hz output sample rate)both analog and digital audio (x and y) to produce new vectors xlpf andylpf, respectively. The filter output is computed by the FIR filterfunction LPF defined in the above pseudocode LPF for performing filterprocessing.xlpf=LPF(x,hlpf,R)ylpf=LPF(v,hlpf,R)

Step 4—Filter vectors xlpf and ylpf to produce new vectors xbass andybass, respectively. The filter output is computed by the FIR filterfunction LPF defined in the above pseudocode LPF for performing filterprocessing.xbass=LPF(xlpf,hbass,1)ybass=LPF(ylpf,hbass,1)

Step 5—Delay vector xlpf by D=(Kbass−1)/2 samples to accommodate bassFIR filter delay. Then subtract vector xbass from the result to yieldnew vector xbpf. Similarly, subtract vector ybass from ylpf (after delayof D samples) to yield new vector ybpf. The output vectors xbpf and ybpfhave the same lengths as vectors xbass and ybass.xbpf_(m)=xlpf_(m+D)−xbass_(m); for m=0 . . . length(xbass)−1ybpf_(n)=ylpf_(n+D)−ybass_(n); for n=0 . . . length(ybass)−1

Step 6—Create new vectors xabs and yabs by computing the absolute valuesof each of the elements of xbpf and ybpf.xabs_(m)=|xbpf_(m)|, for m=0 . . . length(xbpf)−1yabs_(n)=|ybpf_(n)|, for n=0 . . . length(ybpf)−1

Step 7—Filter vectors xabs and yabs to produce new vectors xabsf andyabsf respectively. The filter output is computed by the FIR filterfunction LPF defined in the above pseudocode LPF for performing filterprocessing.xabsf=LPF(xabs,habs,1)yubsf=LPF(bs,habs,1)

Step 8—Filter and decimate by rate Renw=32 (344.53125-Hz output samplerate) both analog and digital audio (xabsf and yabsf) to produce newvectors xenv and yenv, respectively. The filter output is computed bythe FIR filter function LPF defined in the above pseudocode LPF forperforming filter processing.xenv=LPF(xabsf,henv,Renv)yem=LPF(yabsf,henv,Renv)

Step 9—Compute the lag range for the coarse envelope correlation.lagmin=0lagmax=length(yenv)−length(xenv)

Step 10—Use the CROSS_CORRELATE function defined above to compute coarseenvelope correlation-coefficient vectors from input vectors xenv andyenv over the range lagmin to lagmax. Find the correlation maximumpeakenv and the quadratic interpolated peak index lagpqenv. If themeasurement is determined invalid, control is returned to the executiveand processing continues with the next measurement vector of analog anddigital audio samples. Note that efficient computing can eliminateredundant computations.[peakenv,lagpqenv]=CROSS_CORRELATE(xenv,yenv,lagmin,lagmax)

Step 11—Compute the lag range for the fine correlation of xabsf andyabsf. Set the range ±0.5 samples around lagpqenv, interpolate by Renv,and round to integer sample indices.lagabsmin=round[Renv·(lagpqenv−0.5)]lagabsmax=round[Renv·(lagpqenv+0.5)]

Step 12—Use the CROSS_CORRELATE function defined above, to compute finecorrelation coefficient vectors from input vectors xabsf and yabsf overthe range lagabsmin to lagabsmax. Find the correlation maximum peakabsand the quadratic interpolated peak index lagpqabs. If the measurementis determined invalid, control is returned to the executive andprocessing continues with the next measurement vector of analog anddigital audio samples. Note that efficient computing can eliminateredundant computations. Although the time offset is determined to belagpqabs, additional measurements will follow to further improve theconfidence in this measurement.[peakabs,lagpqabs]=CROSS_CORRELATE(xabsf,yabsf,lagabsmin,lagabsmax)

Step 13—Use the CORRELATE_BASS function defined above, to computecorrelation coefficient peakbass from input vectors xbass and ybass atindex lagpqabs.peakbass=CORRELATE_BASS(xbass,ybass,lagpqabs)

Step 14—Compute the offset (in number of 44.1-ksps audio samples)between the analog and digital audio vectors x and y. This is achievedby interpolating fine peak index lagpqabs by R=4 and rounding the resultto integer samples.offset=round[R·lagpqabs]

Step 15—Use the CORRELATION_METRICS function defined above to computethe correlation value corr_coef between the 44.1-ksps analog and digitalaudio input vectors x and y at the measured peak index offset. Thefrequency-domain correlation value corr_phadj is also computed afteraligning the group delays of the x and y vectors. This is used tovalidate the accuracy of the time-offset measurement. Finally, thisfunction generates phase-adjusted digital audio signal ynormadj, whichcan be temporarily substituted for the input digital audio y duringblend ramps to improve sound quality.[corr_coef,corr_phadj,ynormadj]=CORRELATION_METRICS(x,y,offset)

Exemplary coarse (env), fine (abs), and input audio (x, y)cross-correlation coefficients are plotted together in FIG. 13.

The time-offset measurement technique described above was modeled andsimulated with a variety of analog and digital input audio sources. Thesimulation was used to empirically set decision thresholds, refinelogical conditions for validating correlation peaks, and gatherstatistical results to assess performance and compare with otherautomatic time-alignment approaches.

A test vector was input to the simulation and divided into multiplefixed-length blocks of analog and digital audio samples. Each pair ofsample blocks was then correlated and the peak value and index were usedto measure the time offset. This process was repeated for allconstituent sample blocks within the test vector. The results were thenanalyzed and significant statistics were compiled for that particularvector.

Simulations were run on 10 different test vectors, with representativeaudio from various musical genres including talk, classical, rock, andhip-hop. All vectors applied different audio processing to the analogand digital streams, except for F−5+0+0CCC_Mono and F+0 to −9+0+0DRR.

Correlations (as defined in the algorithm description above) wereperformed on all constituent blocks within a test vector. Time offsetand measurement time were recorded for valid correlations. The resultswere then analyzed and statistics were compiled for each vector. Thesestatistics are tabulated in Table 1.

Since actual time offset is often unknown, mean offset is not a veryuseful statistic. Instead, the standard deviation of the time offsetover all sample blocks comprising a test vector provides a bettermeasure of algorithm precision. Mean measurement time is also a valuablestatistic, indicating the amount of time it takes for the algorithm toconverge to a valid result. These statistics are bolded in Table 1.

The results of Table 1 indicate that algorithm performance appears to berobust. The average time-offset standard deviation across all testvectors is 4.2 audio samples, indicating fairly consistent precision.The average measurement time across all test vectors is 0.5 seconds,which is well within HD Radio specifications. In fact, the worst-casemeasurement time across all vectors was just 7.2 seconds.

It is evident from Table 1 that the algorithm yields a relatively largerange of estimated time offsets for some test vectors. This range isprobably accurate, and is likely caused by different audio processingand the resulting group-delay differences between the analog and digitalaudio inputs. Unfortunately, there is no way to know the actual timeoffset at any given instant in each of the test vectors. As a result,ultimate verification of the algorithm can only be achieved throughlistening tests when implemented on a real-time HD Radio receiverplatform.

TABLE 1 Simulation Statistical Results Time Offset (44.1-kHz samples)Measurement Time (seconds) Test Vector Min Max Mean Std Dev Min Max MeanStd Dev NJ_9470 MHz −1 4 2 1.3 0.2 2.4 0.4 0.3 109Vector −197 −149−178.3 10.6 0.2 4.3 0.7 0.7 AM + 0 + 0 + 0HRN 7 20 12.5 2.7 0.2 7.2 1.11 F − 5 + 0 + 0CCC_Mono −7 −4 −5 0.5 0.2 0.2 0.2 0 F + 0 + 0 +0HuRuN_Mono −7 14 6.9 4 0.2 2 0.4 0.3 F + 0 + 0 + 0TuTuN_Mono −11 32 5.69.7 0.2 4.1 1 0.9 F + 0 + 0 + 0DuRuR_Mono −19 −3 −9.3 2.6 0.2 2.2 0.40.3 F + 0 + 0 + 0DuRuC_Mono −8 12 4.2 2.6 0.2 2.2 0.3 0.3 F + 0 + 0 +0DuRuN_Mono −10 28 6.3 6 0.2 3 0.6 0.5 F + 0to − 9 + 0 + 0DRR −10 1 −3.62.4 0.2 0.9 0.2 0.1

In addition to providing automatic time alignment in HD Radio receivers,the described algorithm has other potential applications. For instance,the described algorithm could be used in conjunction with an audioblending method, such as that described in commonly owned U.S. patentapplication Ser. No. 15/071,389, filed Mar. 16, 2016 and titled “MethodAnd Apparatus For Blending An Audio Signal In An In Band On-ChannelRadio System”, to adjust blend thresholds and inhibit blending whenmisalignment is detected. This provides a dynamic blend thresholdcontrol.

FIG. 14 is a signal-flow diagram of an audio blending algorithm withdynamic threshold control. A CRCpass signal on line 160 is amplified byamplifier 162 and passed to an adder 164. The output of the adder isdelayed by delay block 166, amplified by amplifier 168 and returned toadder 164. This results in a digital signal measure (DSM) value on line170. The DSM is limited in block 172, amplified by amplifier 174 andpassed to adder 176, where it is added to a penalty signal Bpen on line178. The resulting signal on line 180 passes to adder 182. The output ofthe adder 182 is delayed by delay block 184, amplified by amplifier 186and returned to adder 182. This produces the DSMfilt signal on line 188.The DSMfilt signal is used in combination with the Thres and ASBMsignals on line 190 to compute an offset and thresholds Th_a2 d, andTh_d2 a as shown in block 192. Th_a2 d and Th_d2 a are compared to DSMin comparators 196 and 198. The outputs of comparators 196 and 198 areused as inputs to flip flop 200 to produce a state_dig signal on line202. The state_dig signal is sent to an inverting input of AND gate 204and delay block 206 produces a delayed state_dig signal for the otherinput of AND gate 204 to produce the Blend_d2 a signal on line 208. TheBlend_d2 a signal is delayed by delay block 210 and used in combinationwith the Thres and Bpen_adj signals on line 212, and the delayedDSMfilt, to compute Bpen as shown in block 214.

The blend algorithm uses an Analog Signal Blend Metric (ASBM) to controlits blend thresholds. The ASBM is currently fixed at 1 for MPS audio and0 for SPS audio. However, the corr_coef or corr_phadj signal from thetime-alignment algorithm could be used to scale ASBM on a continuumbetween 0 and 1. For instance, a low value of corr_coef or corr_phadjwould indicate poor agreement between analog and digital audio, andwould (with a few other parameters) scale ASBM and the associated blendthresholds to inhibit blending. Other alignment parameters that might beused to scale ASBM include level-alignment information, analog audioquality, audio bandwidth, and stereo separation.

In another embodiment, the time-offset measurement could also be usedfor automatic time alignment of the analog and digital audio signals inHD Radio hybrid transmitters. The offset (measured in samples at 44.1ksps) can be filtered with a nonlinear IIR filter to improve theaccuracy over a single measurement, while also suppressing occasionalanomalous measurement results.offset_filt_(k)=offset_filt_(k-1)+α·max[−lim,min(lim,offset_(k)−offset_filt_(k-1))]where ±lim is the maximum allowed input offset deviation from thepresent filtered offset_filt value. The recommended value for lim shouldbe somewhat larger than the typical standard deviation of the offsetmeasurements (e.g., lim=8 samples). The lim nonlinearity suppresses theeffects of infrequent anomalous measured offset values. The parameter αof the single-pole IIR filter is related to its natural time constant rseconds.

$\tau \cong \frac{P}{\alpha}$where P is the offset measurement period in seconds. For example, if α=1/16 and P=3 seconds, then the IIR filter time constant is approximately48 seconds. The time constant is defined as the response time to a stepchange in offset where the filtered output reaches

$1 - \frac{1}{e}$(or about 63%) of the full step size, assuming the step size is lessthan ±lim. Step changes in time alignment offset are generally notexpected; however, they could occur with changes in audio-processorsettings.

The IIR filter reduces the standard deviation of the measured offsetinput values by the square root of α. The filtered offset value can beused to track and correct the time-alignment offset between the analogand digital audio streams.

In another embodiment, the described algorithm could be use forprocessing of intermittent or corrupted signals.

The time-offset measurement algorithm described above includessuggestions for measurements with an intermittent or corrupted signal.Exception processing may be useful under real channel conditions whendigital audio packets are missing (e.g., due to corruption) or when theanalog signal is affected by multipath fading, or experiencesintentional soft muting and/or bandwidth reduction in the receiver. Thereceiver may inhibit time-offset measurements if or when theseconditions are detected.

There are several implementation choices that can influence theefficiency of the algorithm. The normalization components of thecorrelation-coefficient computation do not need to be fully computed forevery lag value across the correlation vector. The analog audionormalization component (e.g., Suua and Suub in the pseudocode of thefirst function corr_coef_vectors called by CROSS_CORRELATE) remainsconstant for every lag, so it is computed only once. The normalizationenergy, mean, and other components of the digital audio vector and itssubsequent processed vectors can be simply updated for every successivelag by subtracting the oldest sample and adding the newest sample.Furthermore, the normalization components could be used later in alevel-alignment measurement.

Also, the square-root operation can be avoided by using the square ofthe correlation coefficient, while preserving its polarity. Since thesquare is monotonically related to the original coefficient, thealgorithm performance is not affected, assuming correlation thresholdvalues are also squared.

After the initial time offset has been computed, the efficiency of thealgorithm can be further improved by limiting the range of lag values,assuming alignment changes are small between successive measurements.The size M of the analog audio input vector x could also be reduced tolimit processing requirements, although using too small an input vectorcould reduce the accuracy of the time-offset measurement.

Finally, the phase-adjusted digital audio ynormadj computed in theCORRELATION_METRICS function could actually be calculated in a differentfunction. This signal was designed to improve sound quality bytemporarily substituting it for input digital audio during blend ramps.But since blends occur sporadically, it could be more efficient tocalculate ynormradj only as needed. In fact, the timing of the ynormadjcalculation must be synchronized with the timing of the blend itself, toensure that the phase-adjusted samples are ready to substitute. As aresult, careful coordination with the blend algorithm is required forthis feature.

From the above description it should be apparent that variousembodiments of the described method for aligning analog and digitalsignals can be used in various types of signal processing apparatus,including radio receivers and radio transmitters. One embodiment of themethod includes: receiving or generating an analog audio stream and adigital audio stream, and using a normalized cross-correlation ofenvelopes of the analog audio stream and the digital audio stream tomeasure a time offset between the analog audio stream and the digitalaudio stream. The normalized cross-correlation of envelopes can becomputed using a vector of bandpass samples of the analog audio streamand a vector of bandpass samples of the digital audio stream.

The described method can be implemented in an apparatus such as a radioreceiver or transmitter. The apparatus can be constructed using knowntypes of processing circuitry that is programmed or otherwise configuredto perform the functions described above.

While the present invention has been described in terms of its preferredembodiments, it will be apparent to those skilled in the art thatvarious modifications can be made to the described embodiments withoutdeparting from the scope of the invention as defined by the followingclaims.

What is claimed is:
 1. A method for processing a digital audio broadcastsignal in a radio receiver, the method comprising: receiving a hybridbroadcast signal; demodulating the hybrid broadcast signal to produce ananalog audio stream and a digital audio stream; and using a normalizedcross-correlation of envelopes of the analog audio stream and thedigital audio stream to measure a time offset between the analog audiostream and the digital audio stream, including: using a coarse envelopecross-correlation computed over a first range of lag values to locate avicinity of the time offset; and subsequently using a fine envelopecross-correlation computed over a second range of lag values, where inthe second range of lag values is narrower than the first range of lagvalues.
 2. The method of claim 1, further comprising: using the timeoffset to align the analog audio stream and the digital audio stream. 3.The method of claim 1, further comprising: blending an output of theradio receiver from the analog audio stream to the digital audio streamor from the digital audio stream to the analog audio stream; and usingthe time offset to scale an analog signal blend metric, to control blendthresholds in the blending of the output of the radio receiver, and toinhibit blending when misalignment is detected.
 4. The method of claim1, further comprising: blending an output of the radio receiver from theanalog audio stream to the digital audio stream or from the digitalaudio stream to the analog audio stream; phase-adjusting the digitalaudio stream; and using the phase-adjusted digital audio stream totemporarily replace input digital audio frames during blend ramps usedin the blending of the output of the radio receiver.
 5. The method ofclaim 1, further comprising: blending an output of the radio receiverfrom the analog audio stream to the digital audio stream or from thedigital audio stream to the analog audio stream; and computingcross-correlation of bass signals of the analog and digital audiostreams to detect potential inversion, to validate time offsetmeasurements, or to improve blend quality.
 6. The method of claim 1,further comprising: blending an output of the radio receiver from theanalog audio stream to the digital audio stream or from the digitalaudio stream to the analog audio stream; and computing cross-correlationof the analog audio stream and the digital audio stream to predict soundquality of a potential blend.
 7. The method of claim 1, wherein: thenormalized cross-correlation of envelopes is computed using a vector ofbandpass samples of the analog audio stream and a vector of bandpasssamples of the digital audio stream.
 8. The method of claim 1, furthercomprising: using quadratic interpolation of peak indices determined bythe envelope cross-correlations to improve resolution of a computed peaklag.
 9. The method of claim 1, wherein; the normalized cross-correlationof envelopes is computed using a vector of samples of the analog audiostream and a vector of samples of the digital audio stream; and thenormalized cross-correlation of envelopes of the vector of samples ofthe analog audio stream and the vector of samples of the digital audiostream produces bifurcated and composite correlation peaks that arecompared for correlation validation via temporal consistency.
 10. Themethod of claim 1, wherein: the normalized cross-correlation ofenvelopes is computed using a vector of samples of the analog audiostream and a vector of samples of the digital audio stream; and thenormalized cross-correlation of envelopes of the analog audio vector andthe digital audio vector produces current and previous peaks that arecompared for correlation validation via temporal consistency.
 11. Themethod of claim 1, further comprising: calculating phase-adjustedfrequency-domain correlation coefficients to validate the time offset.12. A radio receiver comprising: processing circuitry configured to:receive a hybrid broadcast signal; demodulate the hybrid broadcastsignal to produce an analog audio stream and a digital audio stream; usea normalized cross-correlation of envelopes of the analog audio streamand the digital audio stream to measure a time offset between the analogaudio stream and the digital audio stream; compute a coarse envelopecross-correlation over a first range of lag values to locate a vicinityof the time offset; and subsequently compute a fine envelopecross-correlation over a second range of lag values, where in the secondrange of lag values is narrower than the first range of lag values. 13.The radio receiver of claim 12, wherein the processing circuitry isfurther configured to use the time offset to align the analog audiostream and the digital audio stream.
 14. The radio receiver of claim 12,wherein the processing circuitry is further configured to blend anoutput of the radio receiver from the analog audio stream to the digitalaudio stream or from the digital audio stream to the analog audiostream; and to use the normalized cross-correlation of envelopes of theanalog audio stream and the digital audio stream to scale an analogsignal blend metric, to control blend thresholds in the blending step,and to inhibit blending when misalignment is detected.
 15. The radioreceiver of claim 12, wherein the processing circuitry is furtherconfigured to blend an output of the radio receiver from the analogaudio stream to the digital audio stream or from the digital audiostream to the analog audio stream, to phase-adjust the digital audiostream, and to use the phase-adjusted digital audio stream totemporarily replace input digital audio frames during blend ramps usedin the blend of the output of the radio receiver.
 16. The radio receiverof claim 12, wherein the processing circuitry is further configured toblend an output of the radio receiver from the analog audio stream tothe digital audio stream or from the digital audio stream to the analogaudio stream; and to compute cross-correlation of bass signals of theanalog and digital audio streams to detect potential inversion, tovalidate time offset measurements, or to improve blend quality.
 17. Theradio receiver of claim 12, wherein the processing circuitry is furtherconfigured to blend an output of the radio receiver from the analogaudio stream to the digital audio stream or from the digital audiostream to the analog audio stream and to compute cross-correlation ofthe analog audio stream and the digital audio stream to predict soundquality of a potential blend.
 18. The radio receiver of claim 12,wherein the processing circuitry is further configured to computenormalized cross-correlation of envelopes using a vector of bandpasssamples of the analog audio stream and a vector of bandpass samples ofthe digital audio stream.
 19. The radio receiver of claim 12, whereinthe processing circuitry is further configured to use quadraticinterpolation of peak indices to improve resolution of a computed peaklag.
 20. The radio receiver of claim 12, wherein the processingcircuitry is further configured to compute the normalizedcross-correlation of envelopes using a vector of samples of the analogaudio stream and a vector of samples of the digital audio stream toproduce bifurcated and composite correlation peaks; and to compare thebifurcated and composite correlation peaks for correlation validationvia temporal consistency.
 21. The radio receiver of claim 12, whereinthe processing circuitry is further configured to compute the normalizedcross-correlation of envelopes using a vector of samples of the analogaudio stream and a vector of samples of the digital audio stream toproduce current and previous peaks; and to compare the current andprevious peaks for correlation validation via temporal consistency. 22.The radio receiver of claim 12, wherein the processing circuitry isfurther configured to calculate phase-adjusted frequency-domaincorrelation coefficients to validate the time offset.
 23. A method foraligning analog and digital signals; the method comprising: receiving orgenerating an analog audio stream and a digital audio stream; using anormalized cross-correlation of envelopes of the analog audio stream andthe digital audio stream to measure a time offset between the analogaudio stream and the digital audio stream, including: using a coarseenvelope cross-correlation computed over a first range of lag values tolocate a vicinity of the time offset; and subsequently using a fineenvelope cross-correlation computed over a second range of lag values,where in the second range of lag values is narrower than the first rangeof lag values; and using the time offset to align the analog audiostream and the digital audio stream.
 24. The method of claim 23, whereinthe normalized cross-correlation of envelopes is computed using a vectorof bandpass samples of the analog audio stream and a vector of bandpasssamples of the digital audio stream.